package com.sm.healthy.model

import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.ext.requestNoCheck

class HistoryDataViewModel : BaseViewModel() {

    fun getHistory(refresh: Boolean, action: (List<Any>) -> Unit) {
        // TODO: 2021/12/3 获取数据
        //模拟异步获取数据
        requestNoCheck({
            getList()
        }, {
            action(it)
        })
    }

    private suspend fun getList(): List<Any> = withContext(Dispatchers.IO) {
        arrayListOf("", "", "", "")
    }
}